//教师
cc.Class({
    extends: cc.Component,

    properties: {
        //教师巡考速度
        speed: {
            default: 0,
            type: Number
        }
    },

    onLoad () {
        //教师一直处在教室走动
        this.walkAction = this.walkAround();
        this.node.runAction(this.walkAction);
    },

    start () {

    },

    update (dt) {
    },

    //教师不断的在教室巡查
    walkAround () {
        //向下走
        let actionLeftDown = cc.moveBy((70 / this.speed), cc.p(0, -70));
        //向右走
        let actionRight = cc.moveBy((100 / this.speed), cc.p(100, 0));
        //向上走
        let actionRightUp = cc.moveBy((70 / this.speed), cc.p(0, 70));
        //向下走
        let actionRightDown = cc.moveBy((70 / this.speed), cc.p(0, -70));
        //向左走
        let actionLeft = cc.moveBy((100 / this.speed), cc.p(-100, 0));
        //向上走
        let actionLeftUp = cc.moveBy((70 / this.speed), cc.p(0, 70));
        //不断重复
        return cc.repeatForever(cc.sequence(actionLeftDown, actionRight, actionRightUp, actionRightDown,
            actionLeft, actionLeftUp));
    },
});
